from pathlib import Path

from click.testing import CliRunner

from pacli.cli import cli

# def test_help():
#     runner = CliRunner(mix_stderr=True)
#     result = runner.invoke(cli, ['--help'])
#     assert result


def test_filelist(filelist: Path):
    text = filelist.read_text()
    assert text != ''


def test_f(filelist: Path, build_dir: Path):
    runner = CliRunner()
    args = ['error4test', f'--build-dir={build_dir!s}', 'update', f'--filelist={filelist}']
    print(args)
    result = runner.invoke(cli, args, color=True)
    if result.exception:
        raise result.exception
    print(result.output)
    # print(result.stderr)
    print(result.stdout)
    # assert result.exit_code == 0
